package com.aqie.advanced.springApplication.run;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringApplicationRunListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

// SpringApplication 运行监听器
@Slf4j
public class HelloWorldRunListener implements SpringApplicationRunListener {
    // 必须传递这两个参数的构造函数
    public HelloWorldRunListener(SpringApplication application, String[] args) {}
    @Override
    public void starting() {
        log.info("HelloWorldRunListener.starting()...");
        System.out.print("HelloWorldRunListener Run!!!");
    }

    @Override
    public void environmentPrepared(ConfigurableEnvironment environment) {

    }

    @Override
    public void contextPrepared(ConfigurableApplicationContext context) {

    }

    @Override
    public void contextLoaded(ConfigurableApplicationContext context) {

    }

    @Override
    public void started(ConfigurableApplicationContext context) {

    }

    @Override
    public void running(ConfigurableApplicationContext context) {

    }

    @Override
    public void failed(ConfigurableApplicationContext context, Throwable exception) {

    }
}
